// 引入自定义公共函数
import myPubFunction from '@/common/function/myPubFunction.js'
import {
	versionName
} from '/manifest.json'

export default {
	debug: process.env.NODE_ENV !== 'production',
	functionName: 'router',
	versionName,

	login: {
		url: '/pages/login/index'
	},
	imageUrl: 'http://cdn.diaodiandaren.com',
	index: {
		url: '/pages/index/index'
	},
	error: {
		url: '/pages/error/404/404'
	},
	targetTimezone: 8,
	logger: {
		colorArr: ['#0095f8', '#67C23A']
	},

	color: {
		main: '#ff4444',
		secondary: '#555555'
	},
	checkTokenPages: {

		mode: 1,
		list: [
			'/pages/my/index',
			'/pages/index/release',
			'/pages/index/lure',
			'/pages/index/searchFor',
			'/pages/my/otherIndex',
			'/pages/my/report',
			'/pages/my/settled'
		]
	},
	checkSharePages: {

		mode: 0,
		// ['shareAppMessage', 'shareTimeline'],
		menus: ['shareAppMessage'],
		list: ['/pages/index/*', '/pages/goods/*', '/pages_template/*']
	},
	checkEncryptRequest: {

		mode: 1,
		list: [
			'^template/test/pub/testEncryptRequest$',
			'^template/encrypt/(.*)'
		]
	},
	staticUrl: {
		// Logo
		logo: '/static/logo.png'
	},
	myfn: myPubFunction,
	service: {
		cloudStorage: {

			defaultProvider: 'unicloud',
			unicloud: {},
			extStorage: {
				provider: 'qiniu',
				dirname: 'public',
				authAction: 'user/pub/getUploadFileOptionsForExtStorage',
				domain: '',
				groupUserId: false
			},

			aliyun: {
				uploadData: {
					OSSAccessKeyId: '',
					policy: '',
					signature: ''
				},
				action: 'https://xxx.oss-cn-hangzhou.aliyuncs.com',
				dirname: 'public',
				host: 'https://xxx.xxx.com',
				groupUserId: false
			}
		}
	},
	globalErrorCode: {
		'cloudfunction-unusual-timeout': '请求超时，但请求还在执行，请重新进入页面。',
		'cloudfunction-timeout': '请求超时，请重试！',
		'cloudfunction-system-error': '网络开小差了！',
		'cloudfunction-reaches-burst-limit': '系统繁忙，请稍后再试。',
		'cloudfunction-network-unauthorized': '需要进行网络请求许可，若您已授权，请点击确定'
	},
	interceptor: {
		login: function(obj) {
			uni.vk.showLoading('加载中...')
			let {
				vk,
				params,
				res
			} = obj
			// #ifdef APP
			vk.myfn.login()
			// #endif
			// #ifdef H5
			uni.vk.hideLoading()
			vk.navigateTo(params.url)
			// #endif
		},
		fail: function(obj) {
			let {
				vk,
				params,
				res
			} = obj
			return false
		}
	}
}